home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Planet Source Code Jumbo …e CD Visual Basic 1 to 7
/
3_2004-2005.ISO
/
Data
/
Zips
/
FIRE_GDI+179010952004.psc
/
GDIPlus API.bas
< prev
Wrap
BASIC Source File
|
2003-08-01
|
14KB
|
271 lines
Attribute VB_Name = "GDIPlusAPI"
Option Explicit
' Translated by Avery P. - 7/29/2002
' NOTES:
' - All GDI+ Strings expect and return ONLY Unicode - you'll need to use StrConv when using them or convert the APIs to use StrPtr.
' As always, there are a few exceptions to a rule, and ImageTitles are one string that uses only ANSI strings.
' - Functions with an I (i) at the end are non-floating point declarations.
' - If a function without the I (i) at the end doesn't work, try the one with (if any).
' If neither version worked, then you did something wrong, or the API *may* be misdeclared.
' - The word (ALL) next to an API set mean all of the functions are declared. (ALL GDI+ functions are now declared 8/12/2002)
' - Search for "TODO:" (no quotes) to see what still needs done within the file. If there is no TODO, there is nothing to do!
' - If you want to get all of the encoder or decoder file extensions, MIME type, or other values, try to use the Get__Clsid functions as a base.
' - If you don't like the idea of converting strings to and from Unicode, change all As String occurances in the API declarations
' to As Long, and pass the StrPtr() result there instead. I opted to use the As String for clarity, especially since the GDI+ docs are
' geared toward how to use the C++ classes.
' - I may have misdeclared the IStream functions as I'm not too familiar with them. Do a "TODO:" or "IStream" search (no quotes) to see the
' IStream functions. All parameters except one where declared as 'IStream* stream' in C++. The exception has a comment above it. The possible
' problem is that the IStream parameters should be passed ByRef instead of ByVal. If they are wrong, please tell me!
' - APIs are in ordered groups, just like the C++ header, but the groups themselves are not in the same order as in the C++ headers.
'
' WARNINGS:
' - Some of the structs may not work, though I didn't test them all fully.
' - If a function causes a GPF or performs unexpectedly, make sure you are passing correct arguments.
' It also couldn't hurt to double-check the declarations as there is a chance they could be a bit off and looking in the MSDN can't hurt either.
' - Some APIs that have a ByRef parameter may expect an array; check the MSDN to find out if unsure.
'
'-----------------------------------------------
' 2/6/2003
' - I suppose I should put change notifications here in case you missed them on PSC.
' - Altered the ColorPalette to have 256 color palette entries regardless and the flags member is mapped to the PaletteFlags enum.
' - ImageCodecInfo now has the flags member mapped to the ImageCodecFlags enum.
' - GdipBitmapLockBits flags parameter changed to the ImageLockMode enum instead of a Long.
' - Altered the LOGFONTW lfFaceName member to be a String, which is twice as long as the ANSI to adjust for unicode.
' You'll want to use a StrConv on it to get the ANSI text. Also introduced a new constant to ease maintainance: LF_FACESIZEW
'-----------------------------------------------
'-----------------------------------------------
' String Pointer Related APIs (For the String Utilities)
'-----------------------------------------------
Public Declare Function CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal cb As Long) As Long
Private Declare Function lstrlenW Lib "kernel32" (ByVal psString As Any) As Long
Private Declare Function lstrlenA Lib "kernel32" (ByVal psString As Any) As Long
'-----------------------------------------------
' CLSID Generation Related APIs
'-----------------------------------------------
Private Declare Function CLSIDFromString Lib "ole32.dll" (ByVal lpszProgID As Long, pCLSID As CLSID) As Long
'-----------------------------------------------
' GDI+ Constants
'-----------------------------------------------
Public Const LF_FACESIZE As Long = 32
Public Const LF_FACESIZEW As Long = LF_FACESIZE * 2
Public Const FlatnessDefault As Single = 1# / 4#
'Shift count and bit mask for A, R, G, B components
Public Const AlphaShift = 24
Public Const RedShift = 16
Public Const GreenShift = 8
Public Const BlueShift = 0
Public Const AlphaMask = &HFF000000
Public Const RedMask = &HFF0000
Public Const GreenMask = &HFF00
Public Const BlueMask = &HFF
' In-memory pixel data formats:
' bits 0-7 = format index
' bits 8-15 = pixel size (in bits)
' bits 16-23 = flags
' bits 24-31 = reserved
Public Const PixelFormatIndexed = &H10000 ' Indexes into a palette
Public Const PixelFormatGDI = &H20000 ' Is a GDI-supported format
Public Const PixelFormatAlpha = &H40000 ' Has an alpha component
Public Const PixelFormatPAlpha = &H80000 ' Pre-multiplied alpha
Public Const PixelFormatExtended = &H100000 ' Extended color 16 bits/channel
Public Const PixelFormatCanonical = &H200000
Public Const PixelFormatUndefined = 0
Public Const PixelFormatDontCare = 0
Public Const PixelFormat1bppIndexed = &H30101
Public Const PixelFormat4bppIndexed = &H30402
Public Const PixelFormat8bppIndexed = &H30803
Public Const PixelFormat16bppGreyScale = &H101004
Public Const PixelFormat16bppRGB555 = &H21005
Public Const PixelFormat16bppRGB565 = &H21006
Public Const PixelFormat16bppARGB1555 = &H61007
Public Const PixelFormat24bppRGB = &H21808
Public Const PixelFormat32bppRGB = &H22009
Public Const PixelFormat32bppARGB = &H26200A
Public Const PixelFormat32bppPARGB = &HE200B
Public Const PixelFormat48bppRGB = &H10300C
Public Const PixelFormat64bppARGB = &H34400D
Public Const PixelFormat64bppPARGB = &H1C400E
Public Const PixelFormatMax = 15 '&HF
' Image property types
Public Const PropertyTagTypeByte = 1
Public Const PropertyTagTypeASCII = 2
Public Const PropertyTagTypeShort = 3
Public Const PropertyTagTypeLong = 4
Public Const PropertyTagTypeRational = 5
Public Const PropertyTagTypeUndefined = 7
Public Const PropertyTagTypeSLONG = 9
Public Const PropertyTagTypeSRational = 10
' Image property ID tags
Public Const PropertyTagExifIFD = &H8769
Public Const PropertyTagGpsIFD = &H8825
Public Const PropertyTagNewSubfileType = &HFE
Public Const PropertyTagSubfileType = &HFF
Public Const PropertyTagImageWidth = &H100
Public Const PropertyTagImageHeight = &H101
Public Const PropertyTagBitsPerSample = &H102
Public Const PropertyTagCompression = &H103
Public Const PropertyTagPhotometricInterp = &H106
Public Const PropertyTagThreshHolding = &H107
Public Const PropertyTagCellWidth = &H108
Public Const PropertyTagCellHeight = &H109
Public Const PropertyTagFillOrder = &H10A
Public Const PropertyTagDocumentName = &H10D
Public Const PropertyTagImageDescription = &H10E
Public Const PropertyTagEquipMake = &H10F
Public Const PropertyTagEquipModel = &H110
Public Const PropertyTagStripOffsets = &H111
Public Const PropertyTagOrientation = &H112
Public Const PropertyTagSamplesPerPixel = &H115
Public Const PropertyTagRowsPerStrip = &H116
Public Const PropertyTagStripBytesCount = &H117
Public Const PropertyTagMinSampleValue = &H118
Public Const PropertyTagMaxSampleValue = &H119
Public Const PropertyTagXResolution = &H11A ' Image resolution in width direction
Public Const PropertyTagYResolution = &H11B ' Image resolution in height direction
Public Const PropertyTagPlanarConfig = &H11C ' Image data arrangement
Public Const PropertyTagPageName = &H11D
Public Const PropertyTagXPosition = &H11E
Public Const PropertyTagYPosition = &H11F
Public Const PropertyTagFreeOffset = &H120
Public Const PropertyTagFreeByteCounts = &H121
Public Const PropertyTagGrayResponseUnit = &H122
Public Const PropertyTagGrayResponseCurve = &H123
Public Const PropertyTagT4Option = &H124
Public Const PropertyTagT6Option = &H125
Public Const PropertyTagResolutionUnit = &H128 ' Unit of X and Y resolution
Public Const PropertyTagPageNumber = &H129
Public Const PropertyTagTransferFuncition = &H12D
Public Const PropertyTagSoftwareUsed = &H131
Public Const PropertyTagDateTime = &H132
Public Const PropertyTagArtist = &H13B
Public Const PropertyTagHostComputer = &H13C
Public Const PropertyTagPredictor = &H13D
Public Const PropertyTagWhitePoint = &H13E
Public Const PropertyTagPrimaryChromaticities = &H13F
Public Const PropertyTagColorMap = &H140
Public Const PropertyTagHalftoneHints = &H141
Public Const PropertyTagTileWidth = &H142
Public Const PropertyTagTileLength = &H143
Public Const PropertyTagTileOffset = &H144
Public Const PropertyTagTileByteCounts = &H145
Public Const PropertyTagInkSet = &H14C
Public Const PropertyTagInkNames = &H14D
Public Const PropertyTagNumberOfInks = &H14E
Public Const PropertyTagDotRange = &H150
Public Const PropertyTagTargetPrinter = &H151
Public Const PropertyTagExtraSamples = &H152
Public Const PropertyTagSampleFormat = &H153
Public Const PropertyTagSMinSampleValue = &H154
Public Const PropertyTagSMaxSampleValue = &H155
Public Const PropertyTagTransferRange = &H156
Public Const PropertyTagJPEGProc = &H200
Public Const PropertyTagJPEGInterFormat = &H201
Public Const PropertyTagJPEGInterLength = &H202
Public Const PropertyTagJPEGRestartInterval = &H203
Public Const PropertyTagJPEGLosslessPredictors = &H205
Public Const PropertyTagJPEGPointTransforms = &H206
Public Const PropertyTagJPEGQTables = &H207
Public Const PropertyTagJPEGDCTables = &H208
Public Const PropertyTagJPEGACTables = &H209
Public Const PropertyTagYCbCrCoefficients = &H211
Public Const PropertyTagYCbCrSubsampling = &H212
Public Const PropertyTagYCbCrPositioning = &H213
Public Const PropertyTagREFBlackWhite = &H214
Public Const PropertyTagICCProfile = &H8773 ' This TAG is defined by ICC
' for embedded ICC in TIFF
Public Const PropertyTagGamma = &H301
Public Const PropertyTagICCProfileDescriptor = &H302
Public Const PropertyTagSRGBRenderingIntent = &H303
Public Const PropertyTagImageTitle = &H320
Public Const PropertyTagCopyright = &H8298
' Extra TAGs (Like Adobe Image Information tags etc.)
Public Const PropertyTagResolutionXUnit = &H5001
Public Const PropertyTagResolutionYUnit = &H5002
Public Const PropertyTagResolutionXLengthUnit = &H5003
Public Const PropertyTagResolutionYLengthUnit = &H5004
Public Const PropertyTagPrintFlags = &H5005
Public Const PropertyTagPrintFlagsVersion = &H5006
Public Const PropertyTagPrintFlagsCrop = &H5007
Public Const PropertyTagPrintFlagsBleedWidth = &H5008
Public Const PropertyTagPrintFlagsBleedWidthScale = &H5009
Public Const PropertyTagHalftoneLPI = &H500A
Public Const PropertyTagHalftoneLPIUnit = &H500B
Public Const PropertyTagHalftoneDegree = &H500C
Public Const PropertyTagHalftoneShape = &H500D
Public Const PropertyTagHalftoneMisc = &H500E
Public Const PropertyTagHalftoneScreen = &H500F
Public Const PropertyTagJPEGQuality = &H5010
Public Const PropertyTagGridSize = &H5011
Public Const PropertyTagThumbnailFormat = &H5012 ' 1 = JPEG, 0 = RAW RGB
Public Const PropertyTagThumbnailWidth = &H5013
Public Const PropertyTagThumbnailHeight = &H5014
Public Const PropertyTagThumbnailColorDepth = &H5015
Public Const PropertyTagThumbnailPlanes = &H5016
Public Const PropertyTagThumbnailRawBytes = &H5017
Public Const PropertyTagThumbnailSize = &H5018
Public Const PropertyTagThumbnailCompressedSize = &H5019
Public Const PropertyTagColorTransferFunction = &H501A
Public Const PropertyTagThumbnailData = &H501B ' RAW thumbnail bits in
' JPEG format or RGB format
' depends on
' PropertyTagThumbnailFormat
' Thumbnail related TAGs
Public Const PropertyTagThumbnailImageWidth = &H5020 ' Thumbnail width
Public Const PropertyTagThumbnailImageHeight = &H5021 ' Thumbnail height
Public Const PropertyTagThumbnailBitsPerSample = &H5022 ' Number of bits per
' component
Public Const PropertyTagThumbnailCompression = &H5023 ' Compression Scheme
Public Const PropertyTagThumbnailPhotometricInterp = &H5024 ' Pixel composition
Public Const PropertyTagThumbnailImageDescription = &H5025 ' Image Tile
Public Const PropertyTagThumbnailEquipMake = &H5026 ' Manufacturer of Image
' Input equipment
Public Const PropertyTagThumbnailEquipModel = &H5027 ' Model of Image input
' equipment
Public Const PropertyTagThumbnailStripOffsets = &H5028 ' Image data location
Public Const PropertyTagThumbnailOrientation = &H5029 ' Orientation of image
Public Const PropertyTagThumbnailSamplesPerPixel = &H502A ' Number of components
Public Const PropertyTagThumbnailRowsPerStrip = &H502B ' Number of rows per strip
Public Const PropertyTagThumbnailStripBytesCount = &H502C ' Bytes per compressed
' strip
Public Const PropertyTagThumbnailResolutionX = &H502D ' Resolution in width
' direction
Public Const PropertyTagThumbnailResolutionY = &H502E ' Resolution in height
' direction
Public Const PropertyTagThumbnailPlanarConfig = &H502F ' Image data arrangement
Public Const PropertyTagThumbnailResolutionUnit = &H5030 ' Unit of X and Y
' Resolution
Public Const PropertyTagThumbnailTransferFunction = &H5031 ' Transfer function
Public Const PropertyTagThumbnailSoftwareUsed = &H5032 ' Software used
Public Const PropertyTagThumbnailDateTime = &H5033 ' File change date and
' time
Public Const PropertyTagThumbnailArtist = &H5034 ' Person who created the
' image
Public Const PropertyTagThumbnailWhitePoint = &H5035 ' White point chromaticity
Public Const PropertyTagThumbnailPpertyTagImageTitle = &H32bicity
Public o2C ic Const Prs1h &H5f9tyT2e Const Mailc nst ahumbnailDateTime = &H5033 Fu